import java.io._

/**
 * Created by Yair, using IntelliJ IDEA.
 * Date: 13/06/11
 * Time: 12:45
 */

object mainClient{

  def main(args: Array[String]): Unit = {

    //load the server's configuration
   val in_s =  new ObjectInputStream(new FileInputStream("c:\\CDB\\cdb.server.configuration"))  //remove the c:\cdb
   val s_config =in_s.readObject
    val  server_config: ServerConfig = s_config.asInstanceOf[ServerConfig]
    in_s.close

    //load the default (last used and saved) account
    val in_c: ObjectInputStream  = new ObjectInputStream(new FileInputStream("c:\\CDB\\cdb.account.configuration")) //remove c:\cdb
    val account_config: AccountConfig =in_c.readObject.asInstanceOf[AccountConfig]
    in_c.close

    //init the manager
    val manager = Manager
    manager.setServer(server_config.serverIP, server_config.serverPORT)
    manager.setAccount(account_config.cdb_Path, account_config.userName, account_config.password)
    manager.initServer

    //connect to the server            - remove once the GUI was added
    manager.ConnectToServer
  }
}